<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>评论作业</title>
		<script src="http://cdn.bootcss.com/jquery/1.8.3/jquery.js"></script>
		<style>
		*{margin:0;padding:0;}
		ul{list-style:none;}
		a{text-decoration:none;color:none;}
	.comment_list{
	width:990px;
	height:1450px;
	border:2px solid #DDDDDD;
	margin:0px auto;
	font-size:12px;
}
h4{
	height:40px;
	width:970px;
	border:2px solid #DDDDDD;
	line-height:40px;
	padding-left:20px;
	background:#ccc;
	color:#fff;
	margin:0 auto ;
}
.comment_list .list{
	height:140px;
	border-bottom:1px solid #DDDDDD;
	width:990px;
}
.comment_tab{
	overflow:hidden;
	width:990px;
	height:40px;
	line-height:40px;
	background:peachpuff;
	border-bottom:1px solid #CCCCCC;
}
.comment_tab li{
	float:left;
	margin:0 20px;
}
.comment_tab li span{
	font-size:12px;
}

@font-face {font-family: 'iconfont';
    src: url('../font/iconfont.eot'); /* IE9*/
    src: url('../font/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
    url('../font/iconfont.woff') format('woff'), /* chrome、firefox */
    url('../font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
    url('../font/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont{
    font-family:"iconfont" !important;
    font-size:16px;font-style:normal;
    -webkit-font-smoothing: antialiased;
    -webkit-text-stroke-width: 0.2px;
    -moz-osx-font-smoothing: grayscale;}

.comment_list .main_left{
	float:left;
	width:130px;
	height:140px;
	padding-left:10px;
}
.grade_star i{
	color:#f00;
	font-size:12px;
	line-height:28px;
}
.comment_list .main_center{
	float:left;
	height:120px;
	width:610px;
	margin:0 20px;
	padding:10px
}
.comment_list .main_right{
	float:right;
	width:160px;
	height:120px;
	padding:10px;
}
.comment_day,.comment_time,.feature{
	line-height:28px;
}
.user_name img{
	width:40px;
	height:40px;
	float:left;
}
.user_name p{
	float:left;
	margin-left:10px;
	line-height:40px;
	width:100px;
} 
.user_name b{
	display:block;
	font-weight:normal;
	line-height:40px;
}
.page-move{
	height:50px;
	width:230px;
	margin:0 auto;
	padding:5px 380px;
	
}
.page-move a{
	float:left;
	width:100px;
	height:30px;
	line-height:30px;
	text-align: center;
	background:orange;
	color:#fff;
}
.page-move #next{
	margin-left:20px;
}


		</style>
	</head>
	<body>
		<h4>商品评论</h4>
		<div class="comment_list">
			<ul class="comment_tab">
				<li data-num="1655"><a href="#">全部评价</a><span>(1655)</span></li>
				<li data-num="494"><a href="#">晒图</a><span>(494)</span></li>
				<li data-num="1612"><a href="#">好评</a><span>(1612)</span></li>
				<li data-num="32"><a href="#">中评</a><span>(32)</span></li>
				<li data-num="11"><a href="#">差评</a><span>(11)</span></li>
			</ul>
			<div class="list">
				<div class="main_left">
					<div class="grade_star"></div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
			<div class="list">
				<div class="main_left">
					<div class="grade_star">
						
					</div>
					<div class="comment_day"></div>
					<div class="comment_time"></div>
					<div class="feature"></div>
				</div>
				<div class="main_center">
					<div class="comment_cont"></div>
				</div>
				<div class="main_right">
					<div class="user_name">
						<img>
						<p></p>
						<b></b>
					</div>
				</div>
			</div>
		</div>
	<div class="page-move">
		<a href="javascript:;" id="prev">上一页</a>
		<a href="javascript:;" id="next">下一页</a>
	</div>	
	</body>
	<script>
		var num=0;
	$('#prev').click(function(){
		num--;
		if(num<0){
			num=0
		}
		pageMove()
	})
	$('#next').click(function(){
		num++;
		pageMove()
	})
function pageMove(){
	$.ajax({
		url:"http://sclub.jd.com/productpage/p-1643513-s-3-t-3-p-"+num+".html",
		dataType:'jsonp',
		success:function(data){
			
			var arr=data.comments
			for(var i=0;i<arr.length;i++){
				$('.comment_day').eq(i).html('下单'+arr[i].days+'天后评论');
				$('.comment_time').eq(i).html(arr[i].creationTime);
				$('.comment_cont').eq(i).html(arr[i].content);
				$('.feature').eq(i).html(arr[i].productColor);
				$('.user_name img').eq(i).attr('src','http://'+arr[i].userImageUrl);
				$('.user_name p').eq(i).html(arr[i].nickname);
				$('.user_name b').eq(i).html(arr[i].userLevelName);
				$('.grade_star').eq(i).html('');
				for(var j=0;j<arr[i].score;j++){
					
					$('.grade_star').eq(i).append('<i class="iconfont">&#xe611;</i>')
				}
				
		}		

		}
	
	})
}
pageMove()	
	</script>
</html>
